import pandas as pd
import re
from flask import Flask,render_template
from static import settings

app = Flask(__name__)
app.config.from_object(settings)
# f1 = open('recruit_data.csv','r',encoding='utf-8')
# for line in f1:
#     data = line.split(',')
#     if '大数据' in data[0]:
#         value = re.findall(r'大数据|..师|.监|..家|..员|..生',data[0])
#         if len(value)==2 and value[0]=='大数据':
#             print(value)
# f1.close()
f = pd.read_csv('recruit_data.csv')
softWare = f[f['post'].str.contains('大数据')]
data = softWare['experience'].value_counts()[:-1].to_dict()
ans = []
for k,v in data.items():
    ans.append({'name':k,'value':v})

@app.route('/')
def index():
    return render_template('ksh2.html',ans=ans)


if __name__ == '__main__':
    app.run()
